<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up()
    {
        Schema::create('products', function (Blueprint $table) {
            $table->id();
            $table->string('name')->comment('商品名称');
            $table->text('description')->nullable()->comment('商品描述');
            $table->decimal('price', 10, 2)->comment('商品价格');
            $table->integer('stock')->default(0)->comment('库存数量');
            $table->tinyInteger('status')->default(1)->comment('商品状态：1-上架，0-下架');
            $table->string('main_image')->nullable()->comment('商品主图');
            $table->json('images')->nullable()->comment('商品图片集');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    public function down()
    {
        Schema::dropIfExists('products');
    }
}; 